package org.flashbrighton.as3bots.views.ui
{
	import flash.display.*;
	import flash.text.*;
	
	import org.flashbrighton.as3bots.bots.BaseBot;
	
	public class Message extends Sprite
	{
		public static var tf:TextField;
		
		public function Message()
		{
		}
		
		
		public static function create():TextField
		{
			tf = new TextField();
			tf.multiline = true;
			tf.wordWrap = true;
			tf.defaultTextFormat = new TextFormat("_sans", 12, 0xFFFFFF );
			return tf;
		}

		
		public static function write(bot:BaseBot, msg:String):void
		{
			var origin:String = bot!=null?"["+bot.botName +"]: ":"";
			tf.appendText(origin + msg + "\n");
			tf.scrollV = tf.maxScrollV;
		}
		
		
		public static function clear():void 
		{
			tf.text = "";
		}

	}
}